package com.itheima.pojo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页结果封装对象
 */
@Data
public class PageResult<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long total;//总记录数

    private List<T> rows;//当前页结果

    public PageResult(Long total, List<T> rows) {
        this.total = total;
        this.rows = rows;
    }

    public PageResult(Page<T> page) {
        this.rows = page.getRecords();
        this.total = page.getTotal();
    }

    public PageResult() {
    }

}
